﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AQMProject
{
    class BankManager
    {

        BankDAO conn = new BankDAO();
        

        public void Insert()
        {
            BankDAO op = new BankDAO();
            op.Insert();
        }

        public void Update()
        {
            BankDAO op = new BankDAO();
            op.Update();
        }

        public void Delete()
        {
            BankDAO op = new BankDAO();
            op.Delete();
        }

        public List<bankerkennung> getBankMatching()
        {
            BankDAO op = new BankDAO();
            return op.SelectBankmatching();
        }

        public List<bank> getBankList()
        {
            BankDAO op = new BankDAO();
            return op.Select();
        }

        public int getBankID(String l_bankname)
        {
            BankDAO op = new BankDAO();
            List<bank> data = op.SelectBankByName(l_bankname);

            if (data.Count > 0)
            {
                return data[0].IdBank;
            }
            return 0;
        }

        public String getBankName(int l_bankid)
        {
            BankDAO op = new BankDAO();
            List<bank> data = op.SelectBankById(l_bankid);

            if (data.Count > 0)
            {
                return data[0].bankname;
            }
            return "Keine Bank";
        }
    }
}
